﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="frmRegistrarCliente.aspx.cs" Inherits="Farmacia.net.Ventas.Cliente.frmRegistrarCliente" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style3
        {
            width: 100%;
        }
        .style5
        {   
            width: 128px;
            height: 128px;
        }
        .style6
        {
            width: 119px;
        }
        .style7
        {
        }
        .style8
        {
            text-align: right;
        }
    </style>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Registrar Cliente</h2>

<fieldset>
    <legend> Registro Cliente</b></legend>

    <asp:FormView ID="FormView1" runat="server" DataSourceID="odsClient" 
        DefaultMode="Insert" HorizontalAlign="Center">
        <EditItemTemplate>
            <table align="center" class="style3" width="600">
                <tr>
                    <td class="style6" rowspan="6">
                        <img alt="Registro" class="style5" 
                src="../../Images/1340872915_Application.png" />
                    </td>
                    <td class="style7">
                        &nbsp;Identificador :
                        <asp:TextBox ID="IdClienteTextBox" runat="server" 
                            Text='<%# Bind("IdCliente") %>' Width="100px" />
                    </td>
                    <td>
                        &nbsp;RucDni :
                        <asp:TextBox ID="RucDniTextBox" runat="server" Text='<%# Bind("RucDni") %>' />
                    </td>
                    <td colspan="2" rowspan="4">
                        <img alt="Customer" class="style5" 
                src="../../Images/1340873242_demographic.png" />
                    </td>
                </tr>
                <tr>
                    <td class="style7">
                        RazonSocial :</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style7" colspan="2">
                        <asp:TextBox ID="RazonSocialTextBox" runat="server" 
                            Text='<%# Bind("RazonSocial") %>' Width="350px" />
                    </td>
                </tr>
                <tr>
                    <td class="style7" colspan="2">
                        Direccion :</td>
                </tr>
                <tr>
                    <td class="style7" colspan="2">
                        <asp:TextBox ID="DireccionTextBox" runat="server" 
                            Text='<%# Bind("Direccion") %>' Width="350px" />
                    </td>
                    <td rowspan="2" style="text-align: center">
                        <asp:ImageButton ID="btnActualizar" runat="server" CommandName="Update" 
                            ImageUrl="~/Images/1340873474_Save.png" />
                    </td>
                    <td rowspan="2" style="text-align: center">
                        <asp:ImageButton ID="btnCancelar" runat="server" 
                            ImageUrl="~/Images/1340873477_Delete.png" 
                            PostBackUrl="~/Ventas/Cliente/frmBuscarCliente.aspx" />
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        Telefono :&nbsp;
                    </td>
                    <td class="style7">
                        <asp:TextBox ID="TelefonoTextBox" runat="server" 
                            Text='<%# Bind("Telefono") %>' />
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                            ControlToValidate="TelefonoTextBox" ErrorMessage="Ingrese un Valor correcto" 
                            ForeColor="Red" ValidationExpression="[0-9]+"></asp:RegularExpressionValidator>
                        <ajaxToolkit:ValidatorCalloutExtender ID="RegularExpressionValidator1_ValidatorCalloutExtender" 
                            runat="server" Enabled="True" TargetControlID="RegularExpressionValidator1">
                        </ajaxToolkit:ValidatorCalloutExtender>
                    </td>
                </tr>
            </table>
        </EditItemTemplate>
        <InsertItemTemplate>
            <table align="center" class="style3">
                <tr>
                    <td class="style6" rowspan="6">
                        <img alt="Registro" class="style5" 
                src="../../Images/1340872915_Application.png" />
                    </td>
                    <td class="style7">
                        &nbsp;IdCliente :
                        <asp:TextBox ID="IdClienteTextBox" runat="server" 
                            Text='<%# Bind("IdCliente") %>' Width="100px" MaxLength="8" />
                    </td>
                    <td>
                        &nbsp;RucDni :
                        <asp:TextBox ID="RucDniTextBox" runat="server" Text='<%# Bind("RucDni") %>' 
                            Width="100px" MaxLength="11" />
                    </td>
                    <td colspan="2" rowspan="4">
                        <img alt="Customer" class="style5" 
                src="../../Images/1340873242_demographic.png" />
                    </td>
                </tr>
                <tr>
                    <td class="style7">
                        RazonSocial :</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td class="style7" colspan="2">
                        <asp:TextBox ID="RazonSocialTextBox" runat="server" 
                            Text='<%# Bind("RazonSocial") %>' Width="350px" />
                    </td>
                </tr>
                <tr>
                    <td class="style7" colspan="2">
                        Direccion :</td>
                </tr>
                <tr>
                    <td class="style7" colspan="2">
                        <asp:TextBox ID="DireccionTextBox" runat="server" 
                            Text='<%# Bind("Direccion") %>' Width="350px" />
                    </td>
                    <td rowspan="2" style="text-align: center">
                        <asp:ImageButton ID="btnActualizar" runat="server" CommandName="Insert" 
                            ImageUrl="~/Images/1340873474_Save.png" />
                    </td>
                    <td rowspan="2" style="text-align: center">
                        <asp:ImageButton ID="btnCancelar" runat="server" 
                            ImageUrl="~/Images/1340873477_Delete.png" 
                            PostBackUrl="~/Ventas/Cliente/frmBuscarCliente.aspx" ToolTip="Cancelar" />
                    </td>
                </tr>
                <tr>
                    <td class="style8">
                        Telefono :&nbsp;
                    </td>
                    <td class="style7">
                        <asp:TextBox ID="TelefonoTextBox" runat="server" 
                            Text='<%# Bind("Telefono") %>' MaxLength="9" />
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                            ControlToValidate="TelefonoTextBox" Display="Dynamic" 
                            ErrorMessage="Tefefono incorrecto" 
                            ValidationExpression="[0-9]+" ForeColor="Red"></asp:RegularExpressionValidator>
                    </td>
                </tr>
            </table>
        </InsertItemTemplate>
        <ItemTemplate>
            IdCliente:
            <asp:Label ID="IdClienteLabel" runat="server" Text='<%# Bind("IdCliente") %>' />
            <br />
            RucDni:
            <asp:Label ID="RucDniLabel" runat="server" Text='<%# Bind("RucDni") %>' />
            <br />
            RazonSocial:
            <asp:Label ID="RazonSocialLabel" runat="server" 
                Text='<%# Bind("RazonSocial") %>' />
            <br />
            Direccion:
            <asp:Label ID="DireccionLabel" runat="server" Text='<%# Bind("Direccion") %>' />
            <br />
            Telefono:
            <asp:Label ID="TelefonoLabel" runat="server" Text='<%# Bind("Telefono") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Editar" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Eliminar" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="Nuevo" />
        </ItemTemplate>
    </asp:FormView>
    <asp:ObjectDataSource ID="odsClient" runat="server" 
        DataObjectTypeName="Farmacia.Entities.Cliente" DeleteMethod="DeleteCliente" 
        InsertMethod="RegistrarCliente" ondeleted="odsClient_Deleted" 
        oninserted="odsClient_Inserted" onobjectcreated="odsClient_ObjectCreated" 
        onupdated="odsClient_Updated" SelectMethod="GetFromClienteById" 
        TypeName="Farmacia.BussinessLogic.ClienteBL" UpdateMethod="RegistrarCliente">
        <DeleteParameters>
            <asp:QueryStringParameter Name="id" QueryStringField="IdCliente" Type="Int32" />
        </DeleteParameters>
        <SelectParameters>
            <asp:QueryStringParameter Name="id" QueryStringField="IdCliente" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
</fieldset>

</asp:Content>
